package com.berchen.utils;

import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
import org.springframework.web.context.support.WebApplicationObjectSupport;

/**
 * 获取IOC容器
 * web环境下
 * springContextUtils4.getApplicationContext() 方法就可以拿到IOC容器了
 *
 * 底层也是使用的 ApplicationContextAware 的setApplicationContext 实现的；
 */
@Component
public class SpringContextUtils4 extends WebApplicationObjectSupport {
    public ApplicationContext getIoc(){
        return getApplicationContext();
    }
}
